package com.lhd.qd.module.system.dict.model.converter;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lhd.qd.module.system.dict.model.dataobj.DictDO;
import com.lhd.qd.module.system.dict.model.dto.DictSaveDTO;
import com.lhd.qd.module.system.dict.model.dto.DictUpdateDTO;
import com.lhd.qd.module.system.dict.model.vo.DictCacheVO;
import com.lhd.qd.module.system.dict.model.vo.DictDetailVO;
import com.lhd.qd.module.system.dict.model.vo.DictListVO;
import org.mapstruct.Mapper;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public abstract class AbstractDictConverter {

    public static AbstractDictConverter INSTANCE = Mappers.getMapper(AbstractDictConverter.class);

    public abstract Page<DictListVO> doPage2ListVOPage(IPage<DictDO> doPage);

    public abstract DictDetailVO do2DetailVO(DictDO dataObj);

    public abstract DictDO saveDTO2DO(DictSaveDTO saveDTO);

    public abstract DictDO updateDTO2DO(DictUpdateDTO updateDTO);

    @Named("do2CacheVO")
    public abstract DictCacheVO do2CacheVO(DictDO dataObj);

    public abstract List<DictCacheVO> doList2CacheVOList(List<DictDO> doList);
}
